import workerpool from "workerpool";
import workerDepts from "./modules";

function runWithDepts(fn: any, ...args: any) {
    try {
        const f = new Function("return (" + fn + ").apply(null, arguments);");
        return f.apply(f, [workerDepts].concat(args));
    } catch (e) {
        console.error(e);
        throw e;
    }
}

workerpool.worker({
    runWithDepts
});
